The invention relates to a gateway for a vehicle. Furthermore, the invention relates to a node of a bus system in a vehicle. Furthermore, the invention relates to a method for the synchronization of bus systems in a vehicle.
Current vehicles comprise a multiplicity of sensors, actuators and control devices which control and regulate a multiplicity of functions of the vehicle. This multiplicity of components is interconnected in the vehicle via communication systems composed of different bus systems in order to enable an exchange of data between the multiplicity of components. Examples of bus systems in vehicles are e.g. synchronous FlexRay bus systems, asynchronous CAN (Controller Area Network) bus systems or synchronous MOST (Media Oriented Systems Transport) bus systems, which are usually interconnected via a gateway. The components connected to the different bus systems can thus exchange information relating to the operating conditions and further relevant data in the vehicle and can initiate suitable control and regulation measures.
One object of the present invention is to provide an improved gateway for a vehicle. A further object of the present invention is to provide an improved node of a bus system in a vehicle. Finally, a further object of the present invention is to provide an improved method for the synchronization of bus systems in a vehicle.
These and other objects are achieved according to the invention.
If the exchange of data takes place beyond the boundaries of an essentially synchronous bus system (e.g. of a FlexRay bus system), no facility exists in current vehicles to determine the exact age of the exchanged data. In other words, the recipient of the data cannot determine exactly how long ago the exchanged data were dispatched by the sender of the data. In other words again, it is not possible in current vehicles to detect and precisely determine a latency in the data transmission beyond the boundaries of an essentially synchronous bus system (e.g. of a FlexRay bus system). The present invention addresses these technical problems. In particular, the present invention describes devices and methods which enable the “age” of exchanged data in a vehicle to be determined (even beyond the boundaries of a bus system).
According to one aspect of the invention, a gateway for a vehicle is described. The gateway may be a gateway which interconnects a multiplicity of different bus systems and which enables an exchange of messages between the nodes of the multiplicity of different bus systems. The gateway can also be referred to as a bus system coupler or bus system transition. The gateway is typically configured to forward a payload message from a first node of a first fieldbus system to a second node of a second fieldbus system. The first and second fieldbus systems may be different. For this purpose, the gateway can receive the payload message as a node of the first fieldbus system. The payload message is typically encoded in the first fieldbus system according to a first protocol of the first fieldbus system. The gateway can then encode the received payload message into a payload message according to a second protocol of the second fieldbus system, and can transmit the transcoded payload message as a node of the second fieldbus system to the second node. The gateway is typically also configured to forward a payload message from the second node to the first node.
The first and/or second node comprise e.g. in each case a sensor, an actuator and/or a control device (Electronic Control Unit). Consequently, the payload message can include measurement data and/or control data. Furthermore, the payload message can include a timestamp which indicates a generation time of the measurement data and/or the control data. The first fieldbus system may be a serial, asynchronous fieldbus system, such as e.g. a CAN fieldbus system. The second fieldbus system may be a serial, synchronous fieldbus system, such as e.g. a FlexRay fieldbus system.
The gateway is configured to synchronize a first clock in the first node with a second clock in the second node. The first and/or second clock may comprise an oscillator, i.e. a clock generator, and/or a counter. For example, the counter of the first and/or second clock may be incremented/decremented depending on the oscillator (i.e. depending on the clock generator) in order to indicate a specific clock time. The synchronization of the first and second clock can be effected e.g. in that the counters of the first and second clock have corresponding (e.g. the same) counter readings at the same time. Due to the synchronization of the clocks, it can be achieved that a timestamp generated on the basis of the first clock which is transmitted in the payload message makes a clear statement in the second node regarding the time period that has elapsed since the generation of the timestamp.
In order to synchronize the first and second clock, the gateway can be configured to determine a timestamp on the basis of a reference time. This reference time may be, e.g., a time of a clock of the gateway. In embodiments, the reference time can be determined on the basis of a time received by a GPS receiver of the vehicle and/or on the basis of a time received by an instrument cluster of the vehicle. The timestamp can be transmitted to the first node in a first message according to the first protocol of the first fieldbus system. In the same way, the timestamp (or a different timestamp determined on the basis of the reference time) can be transmitted to the second node in a second message according to the second protocol of the second fieldbus system. The first and the second protocols typically differ from one another. For example, the first protocol is a CAN protocol and the first message is a CAN telegram. The second protocol may be a FlexRay protocol and the second message may be a FlexRay frame in a time window of a FlexRay cycle.
In particular, the gateway can be configured to synchronize the first clock in the first node with the second clock in the second node using a Precision Time Protocol (PTP) method. In other words, the first and second message may be a Sync Message and/or a Follow_Up Message. For example, the gateway can be configured to transmit the timestamp (e.g. using a Sync Message and/or a Follow_Up Message to the first and/or second node). Furthermore, the gateway can be configured to enable the first and/or second node to determine a round trip time, a cycle time and/or a message transit time. To do this, the gateway can receive, e.g., a Delay_Req Message from the first and/or second node and reply with a Delay_Resp Message to the first and/or second node. The first and/or the second node can then synchronize their respective clocks using the time stamp and with knowledge of the transit time of the first or second message.
The gateway can also be configured to generate the timestamp as a segment or as a subdomain from a PTP timestamp. Typical PTP timestamps have a length of 10 bytes and indicate an absolute time (e.g. the UNIX time from midnight on 1.1.1970). Due to the limited length of the messages defined in the first and/or second protocol, it may be advantageous to generate a shortened timestamp from the PTP timestamp, wherein the shortened timestamp comprises a specific maximum measurable time period and enables a specific time resolution. For example, the (shortened) time period which is transmitted in the first and/or second message can be generated from a nanosecondsField of the PTP timestamp. The (shortened) timestamp can be selected, for example, in such a way that the maximum measurable time period of the timestamp corresponds to a transit time (e.g. a predefined maximum possible transit time) of the payload messages from the first node to the second node, or exceeds said transit time. It can thereby be ensured that the second node can clearly determine the time period since the generation of the (shortened) timestamp.
The gateway can be configured to transmit the second message in a predefined time window of the second bus system. For example, the predefined time window may be a predefined, recurring slot in which the gateway is allowed to transmit messages in the second bus system (e.g. a synchronous bus system). The timestamp can then be defined in such a way that the timestamp corresponds to a time of the predefined time window. In other words, the timestamp which is transmitted in the second message can be defined in such a way that the timestamp matches the transmit time of the second message. This enables the second node in a synchronous bus system (e.g. in a FlexRay bus system) to use the timestamp directly in order to synchronize the second clock without it requiring a further Follow_Up Message and/or further Delay_Req/Delay_Resp Messages. The required data overhead for the time synchronization can thus be reduced.
According to a further aspect of the invention, a node is described for a CAN bus system. The node includes a clock which is designed to define a timestamp with a predefined measurable time period and a predefined time resolution. In preferred exemplary embodiments, the clock of the CAN node is designed to be synchronized with a reference time (e.g. the reference time of the aforementioned gateway). To do this, the node can be designed to carry out the synchronization methods described herein (in particular the PTP-based synchronization method described herein). Furthermore, the node includes a control unit which is designed to provide a payload to be transmitted with a payload timestamp. It is thus possible to inform other nodes of the age of the payload to be transmitted.
The payload timestamp can have a shortened measurable time period as the predefined measurable time period and/or an increased time resolution as the predefined time resolution. In other words, the CAN node can be configured to generate shortened payload timestamps in order to thus reduce the overhead for the payload timestamp in the data field of the CAN telegram.
According to a further aspect of the invention, a method is described for synchronizing a time in a synchronous bus system of a vehicle. The method comprises the determination of a timestamp on the basis of a reference time, and the determination of a time interval up until a transmit time window of the synchronous bus system. The time stamp is then corrected using the determined time interval (e.g. the timestamp is added to the determined time interval) in order to determine a corrected timestamp. A message with the corrected timestamp is then transmitted within the transmit time window. Due to the corrected timestamp, a receiver node in the synchronous bus system is enabled to synchronize its clock directly with the reference time on the basis of the corrected timestamp without exchanging further messages. Consequently, the synchronization method for synchronous bus systems can be designed as more efficient due to the correction.
The method can also serve to synchronize the time in an asynchronous bus system. For this purpose, the method can comprise the transmission of a further message with the timestamp and the time interval in the asynchronous bus system, wherein the asynchronous bus system is different from the synchronous bus system. Through the knowledge of the timestamp and the time interval, a node in the asynchronous bus system is enabled to select the transmit time of a message which is intended for a node in the synchronous bus system in such a way that the transit time of the message is reduced.
It must be noted that the methods, devices and systems described in this document can be used both alone and in combination with other methods, devices and systems described herein. Furthermore, any aspects of the methods, devices and systems described herein can be combined with one another in diverse ways.
Other objects, advantages and novel features of the present invention will become apparent from the following detailed description of one or more preferred embodiments when considered in conjunction with the accompanying drawings.